// this is done when page is loaded
$(function() {
	/*
	alert("inicio");
	   $.getJSON("CanchaServlet",{action : "listarDuenos"},displayDuenos);
	   */
});
	
	    

//callback function para displayDuenos
function displayDuenos(data) {
	
    $.each(data.duenos, function(index,dueno) {
        // add items to List box
        $("#xduenos").append("<option value='" + dueno.id + "'>" + dueno.title + "</option");
    	/*
    	alert("sigue=" + n++);
    	$('#grid').append("Holaaaa<br>");
    	*/
       }
    );
}

/*
function displayDuenos2() {
	alert("Duenosss");
	$.ajax({
		   type: "POST",
		   url: "CanchaServlet",
		   dataType: "json",
		   data: params,
		   success: function(d){
		     $("#grid").html(d);			 
		   }
		  });	
}

function listarCanchas(cod){
    var params = $.param({action:"listar"});
    $.ajax({
    type: "POST",
    url: "/CanchaServlet",
    dataType: "json",
    data: params,
    success: function(o){
        var str = '<label>Provincia</label><select id="cboPcia" name="cboPcia">';
        str += '<option value="">-Seleccione-</option>';
        for (var i = 0; i < o.length; i++)
        {
            if(idPcia == o[i].pvc_cod){
                str += '<option value="' + o[i].pvc_cod + '" selected>' + o[i].pvc_des + '</option>';
            } else {
                str += '<option value="' + o[i].pvc_cod + '">' + o[i].pvc_des + '</option>';
            }


        }
        // $("#data").html(o);
        str += '</select>';
        $('#dataPcia').html(str);
        if(idPcia == null) {
            $('#cboPcia').focus();
        }
    }
  });
}
*/